import { service } from '@/utils/request';

/**
 * 获取所有榜单
 * @param {string} userId 
 * @param {string} topic 
 * @return 
 */ 
export function AppGetRankingInfoApi(userId: string, topic: string) {
    return service.get(`/getRankingInfoAll?userId=${encodeURIComponent(userId)}&topic=${encodeURIComponent(topic)}`);
}

/**
 * 收藏
 */

export function AppCreateFavoriteApi(userId: string, rankingId: string) {
    return service.post(`/createFavorite?userId=${encodeURIComponent(userId)}&rankingId=${encodeURIComponent(rankingId)}`);
}
/**
 * 取消收藏
 */
export function AppDeleteFavoriteApi(userId: string, rankingId: string) {
    return service.delete(`/deleteFavorite?userId=${encodeURIComponent(userId)}&rankingId=${encodeURIComponent(rankingId)}`);
}
/**
 * 获取所有收藏
 */
export function AppGetFavoriteAllApi(userId: string) {
    return service.get(`/getFavoriteAll?userId=${encodeURIComponent(userId)}`);
}

/**
 * 获取参与投票历史
 */
export function AppGetHistoryAllApi(userId: string) {
    return service.get(`/getHistoryAll?userId=${encodeURIComponent(userId)}`);
}
/**
 * 获取评论
 * @param {string} rankingId 
 * @return 
 */ 
export function AppGetCommentsAllApi( rankingId: string) {
    return service.get(`/getCommentsAll?rankingId=${encodeURIComponent(rankingId)}`);
}

/**
 * 创建评论
 * @return 
 */
export interface CommentVo{
	rankingId:number,
	userId:number,
	content:string
	
} 
export function AppCreateCommentsApi( data: CommentVo) {
    return service.post(`/createComments`,data);
}
/**
 * 获取所有通知
 * @return 
 */ 
export function AppGetNotificationAllApi() {
    return service.get(`/getNotificationAll`);
}